import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * \* Created with IntelliJ IDEA.
 * \* User: Administrator
 * \* Date: 2022/5/17
 * \* Time: 20:41
 * \* To change this template use File | Settings | File Templates.
 * \* Description:
 * \
 */

@WebServlet("/hello")
public class HelloServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        //不能调用父类的doGet
        //super.doGet(req, resp);

        //这个是让服务器在自己的控制台里打印
        System.out.println("hello world!");
        //在页面上也能打印hello world ，把hello world字符串放到http响应的body中，
        //那么，浏览器就会把body的内容显示到页面上
        resp.getWriter().write("hello world!"+ System.currentTimeMillis());
    }


}
